import http from '@/utils/http/axios'
import {ContentTypeEnum} from '@/enums/httpEnum'

enum Api {
    portList = '/port/getAll',
    portCreate = '/port/create',
    portDelete = '/port/delete',
    portUpdate = '/port/update',
    portInTemp = '/port/intemp',
    portUpdateTemp = '/port/updatetemp',
}

/**
 * @description: 修改
 */
export function portUpdate(params: any) {
    return http.request({
        url: Api.portUpdate,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isParseToJson: true,
        isShowMessage: true,
        successMessageText: '修改成功',
        errorMessageText: '修改失败'
    })
}

/**
 * @description: 删除
 */
export function portDelete(params: any, option: any) {
    return http.request({
        url: Api.portDelete,
        method: 'POST',
        params,
    },{
        ...option,
        isTransformRequestResult: false,
        successMessageText: '删除成功',
        errorMessageText: '删除失败'
    })
}

/**
 * @description: 添加
 */
export function portCreate(params: any) {
    return http.request({
        url: Api.portCreate,
        method: 'POST',
        params,
    },{
        isTransformRequestResult: false,
        isParseToJson: true,
        isShowMessage: true,
        successMessageText: '添加成功',
        errorMessageText: '添加失败'
    })
}

/**
 * @description: 获取
 */
export function portList(params: any) {
    return http.request({
        url: Api.portList,
        method: 'GET',
        params,
    },{
        isTransformRequestResult: false
    })
}

export function portInTemp(tempid: number){
    return http.request({
        url: Api.portInTemp,
        method: 'POST',
        params: {"tempid":tempid},
    })
}

export function portUpdateTemp(params: any){
    return http.request({
        url: Api.portUpdateTemp,
        method: "POST",
        params,
    })
}
